#pragma once
#ifndef SCREEN_H
#define SCREEN_H

#include <d3d9.h>
#include <d3dx9.h>

class Screen
{
protected:
	// Holds background texture and position.
	IDirect3DTexture9* m_background;
	D3DXVECTOR3 m_backgroundPos;
	// Holds inforamtion pane texture and position.
	IDirect3DTexture9* m_infoPane;
	D3DXVECTOR3 m_infoPanePos;
	D3DVIEWPORT9 m_viewport;
public:
	Screen(IDirect3DTexture9* background, IDirect3DTexture9* infoPane, D3DVIEWPORT9 viewport)
	{
		// Set textures & positions.
		m_background = background;
		m_infoPane = infoPane;
		m_backgroundPos = D3DXVECTOR3(0,0,0);
		// Place infoPane in centre of screen.
		D3DSURFACE_DESC infoDesc ;
		m_infoPane->GetLevelDesc(0, &infoDesc);
		m_infoPanePos = D3DXVECTOR3((1280 / 2 - infoDesc.Width / 2), (720 / 2 - infoDesc.Height / 2), 0);
	}
	void draw(ID3DXSprite* sprite)
	{
		if (m_background != NULL)
			sprite->Draw(m_background, 0, 0, &m_backgroundPos, D3DCOLOR_XRGB(255,255,255));
		if (m_infoPane != NULL)
			sprite->Draw(m_infoPane, 0, 0, &m_infoPanePos, D3DCOLOR_XRGB(255,255,255));
	}
	~Screen() {}
};

#endif // SCREEN_H